﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DevOnServer
{
    public class CDropObject : CWorldObject
    {
        public CDropObject(int id, CWorld world)
            : base(id, world)
        {
        }

        public override ObjType Type
        {
            get
            {
                return ObjType.Drop;
            }
        }

        private CPlayerObject m_owner;

        public CPlayerObject Owner
        {
            get
            {
                return m_owner;
            }
            set
            {
                m_owner = value;

                if (m_owner != null)
                    OwnerShipEnd = s_time + 30000;
            }
        }

        public int OwnerShipEnd;

        public int RemoveTime;

        public CItemProp ItemProp;

        public override void update()
        {
            if (RemoveTime != 0
                && s_time >= RemoveTime)
            {
                World.removeObject(this);
            }

            if (Owner != null
                && s_time >= OwnerShipEnd)
            {
                Owner = null;
            }
        }
    }
}